package epin.fujiajun.sort.primary;

import epin.fujiajun.data.Array;
import epin.fujiajun.data.array.Number;
import epin.fujiajun.sort.ArraySortBase;


/**
 * Created by DELL on 2017/8/15.
 */
public class Selection extends ArraySortBase {

    @Override
    public void sort(Array[] a) {
        int N = a.length;
        for (int i = 0; i < N; i++){
            int min = i;
            for (int j = i + 1; j < N; j++){
                if (!less(a[min], a[j])){
                    min = j;
                }
            }
            exChange(a, i, min);
        }
    }


    public static void main(String[] args){
        new Selection().main(Number.createArray(100, 1000));
    }
}
